var app = new Vue({
	el: '#app',
	mixins: [isLogin],
	components: {
		login: login,
		footers:footer,
	},
	data: {
		mobileTapId:1,//控制手机端的热门课程分类的切换
		showNavModal:false,//控制首页的导航弹窗
		keyWord: '', //搜索关键字
		hotClass: [], //热门课程数据
		hotClassOne: [ //考证报班
			{
				cname: 'animated fadeInRight',
                img: 'img/PCindex/九大员.jpg',
				name: '九大员',
				//title: 'Nine big members',
				btn: [{
					href: 'ninebigmember.html',
					cname: 'one',
					title: '报名流程'
				}, ]
			},
			{
				cname: 'animated fadeInRight',
				img: 'img/PCindex/44.png',
				name: '特种工',
				//title: 'Special work',
				btn: [{
					href: 'special_job.html',
					cname: 'one',
					title: '报名流程'
				}, ]
			},
			{
				cname: 'animated fadeInRight',
				img: 'img/PCindex/66.png',
                name: '技能人员',
				//title: 'Professional',
				btn: [{
					href: 'professional.html',
					cname: 'one',
					title: '报名流程'
				}, ]
			},
			{
				cname: 'animated fadeInRight',
				img: 'img/PCindex/33.png',
				name: '安管人员',
				//title: 'Ann staff',
				btn: [{
					href: 'anguanrenyuan.html',
					cname: 'one',
					title: '报名流程'
				}, ]
			},
		],
		hotClassTwo: [ //继续教育
			{
				cname: 'animated fadeInLeft',
				img: 'img/PCindex/55.png',
				name: '二级建造师',
				//title: 'Secondary builder',
				btn: [{
					href: 'edu_ninebigmember.html',
					cname: 'one',
					title: '报名流程'
				}, ]
//				btn: [{
//						href: 'ninebigmember.html',
//						cname: '',
//						title: '学习'
//					},
//					{
//						href: '',
//						cname: 'bgCur',
//						title: '报考'
//					},
//				]
			},
			{
				cname: 'animated fadeInLeft',
				img: 'img/PCindex/44.png',
				name: '特种工',
				//title: 'Special work',
				btn: [{
					href: 'edu_special_job.html',
					cname: 'one',
					title: '报名流程'
				}, ]
			},
			{
				cname: 'animated fadeInLeft',
				img: 'img/PCindex/66.png',
                name: '专业技术人员',
				//title: 'Professional',
				btn: [{
					href: 'edu_privacy_protection.html',
					cname: 'one',
					title: '报名流程'
				}, ]
			},
			{
				cname: 'animated fadeInLeft',
				img: 'img/PCindex/33.png',
				name: '安管人员',
				//title: 'Ann staff',
				btn: [{
					href: 'edu_anguanrenyuan.html',
					cname: 'one',
					title: '报名流程'
				}, ]
			},
		],
		hotClassThree: [ //学历晋升
			{
				cname: 'animated fadeInRight',
				img: 'img/PCindex/education_background1.jpg',
				name: '专升本',
				//title: 'Undergraduate course',
				btn: [{
                    href: 'http://www.guangxinedu.cn/school.asp',
					cname: 'one',
                    title: '在线报名'
				}, ]
			},
			{
				cname: 'animated fadeInRight',
				img: 'img/PCindex/education_background2.jpg',
				name: '高升专',
				//title: 'College',
				btn: [{
                    href: 'http://www.guangxinedu.cn/school.asp',
					cname: 'one',
					title: '在线报名'
				}, ]
			},
			{
				cname: 'animated fadeInRight',
				img: 'img/PCindex/education_background3.jpg',
				name: '高升本',
				//title: 'Technical secondary school',
				btn: [{
                    href: 'http://www.guangxinedu.cn/school.asp',
					cname: 'one',
                    title: '在线报名'
				}, ]
			},
		],
		hotKeyWord: '', //热门关键字
	},
	methods: {
		//header组件的搜索方法
		searchHeader(searchCtx) {

		},
		//获取热门关键字
		getKeyWord() {
			var method = 'BigData/GetHotSearch';
			var param = {};
			xq.getUrl(method, param, (res) => {
				if(res.data) {
					this.hotKeyWord = res.data;
				}
			});
		},
		showBuildingModal:function(){
			xq.toast();
		},
		//初始化动画效果脚本
		initScript() {
			var _this = this;
			//				初始化热门课程的内容
			_this.hotClass = _this.hotClassOne;
			//			window.onresize = function() {
			//				location.reload();
			//			}
			if(xq.device == 1) {
				$('#hotClassTab').on('mouseenter', 'li', function() {
					$(this).addClass('curColor').siblings().removeClass('curColor');
					var tabId = parseInt($(this).attr('data-id'));
					switch(tabId) {
						case 1:
							_this.hotClass = _this.hotClassOne;
							break;
						case 2:
							_this.hotClass = _this.hotClassTwo;
							break;
						case 3:
							_this.hotClass = _this.hotClassThree;
							break;
					}
				});
				//服务的动画
				$('#service').on('mouseenter', 'li', function() {
					$(this).find('h2').addClass('animated flash');
				});
				$('#service').on('mouseleave', 'li', function() {
					$(this).find('h2').removeClass('animated flash');
				});
				//私人管家的动画
				$('#circleAnimate').on('mouseenter', '.circle', function() {
					$(this).addClass('infinite');
				});
				$('#circleAnimate').on('mouseleave', '.circle', function() {
					$(this).removeClass('infinite');
				});
			}
		},
		//点击搜索按钮
		searchBtn: function() {
			if(this.keyWord) {
				location.href = 'searchList.html?keyWord=' + this.keyWord;
			} else {
				location.href = 'search.html';
			}
		},
		//手机端点击切换导航
		mobileTapNav:function(){
			this.showNavModal = true;
		},
		//手机端点击隐藏导航
		hideMobileNav:function(event){
			var isModal = $(event.target).hasClass('xs-modal');
			if(isModal){
				this.showNavModal = false;
			}
		},
		//手机端切换
		mobileTap: function(tapId) {
			this.mobileTapId = tapId;
			switch(tapId) {
				case 1:
					this.hotClass = this.hotClassOne;
					break;
				case 2:
					this.hotClass = this.hotClassTwo;
					break;
				case 3:
					this.hotClass = this.hotClassThree;
					break;
			}
		},
		//点击热门搜索关键字
		clickHotKeyWord: function(hotWord) {
			if(hotWord) {
				location.href = 'searchList.html?keyWord=' + hotWord;
			}
		},
	},
	mounted() {
		this.initScript();
		this.getKeyWord();
	},
	updated() {

	}
})